var app = angular.module('ZJPC');
app.controller('BasicCarFileCtrl', ['$scope','$state','$rootScope','$stateParams','DataService',BasicCarFileCtrl]);

function BasicCarFileCtrl($scope,$state,$rootScope,$stateParams,DataService) {

	console.log($stateParams.name)
	if($stateParams.data.indexOf('{')==0){
		callback(angular.fromJson($stateParams.data))
	}else{
		$scope.loading = true;
		DataService.getCar($stateParams.name,callback)
	}
/*	$scope.loading = true;
	DataService.getCar($stateParams.name,callback)*/
	

	function callback(data){
		$scope.loading = false;
		$scope.carFile = data[0];
	}
}